package com.lanou.web.controller;

import com.lanou.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by QuChao on 2018/12/5
 */
@RestController
@RequestMapping("/member")
public class OrderController {
    @Autowired
    private OrderService orderService;

    @GetMapping("/addressList")
    public Map<String, Object> getAddressList(@RequestBody Map<String, Object> map) {
        return orderService.getAddress(map);
    }

    @GetMapping("/delAddress")
    public Map<String, Object> deleteAddress(@RequestBody Map<String, Object> map) {
        return orderService.deleteAddress(map);
    }

    @GetMapping("/addAddress")
    public Map<String, Object> addAddress(@RequestBody Map<String, Object> map) {
        return orderService.addAddress(map);
    }

    @GetMapping("/updateAddress")
    public Map<String, Object> updateAddress(@RequestBody Map<String, Object> map) {
        return orderService.updateAddress(map);
    }

    @GetMapping("/addOrder")
    public Map<String, Object> addOrder(@RequestBody Map<String, Object> map) {
        return orderService.addOrder(map);
    }

    @GetMapping("/orderDetail")
    public Map<String, Object> orderDestail(Long orderId) {
        return orderService.detail(orderId);
    }
}
